import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import './plugins/element.js'  

// 导入富文本编辑框
import VueQuillEditor from "vue-quill-editor"
// 全局注册
Vue.use(VueQuillEditor)


// 导入进去条插件
import NProgress from 'nprogress'

// 导入全局样式
import "./assets/css/global.css"
// 导入第三方字体库
import "./assets/fonts/iconfont.css"
Vue.config.productionTip = false

import axios from 'axios'
// 配置请求根路径
axios.defaults.baseURL = "http://150.139.222.251:8888/api/private/v1/"

// 请求拦截器, 添加 Authorization 字段
axios.interceptors.request.use(config => {
  NProgress.start()
  config.headers.Authorization = window.sessionStorage.getItem("token")
  return config
})

// 相应拦截器
axios.interceptors.response.use(config => {
  NProgress.done()
  return config
})

// 导入 'vue-table-with-tree-grid' 插件
import TreeTable from 'vue-table-with-tree-grid'
Vue.component("tree-table", TreeTable)

// 定义全局时间过滤器
Vue.filter('timeFormate', function(val) {
  let date = new Date(val)
  return `${date.getFullYear()}-${(date.getMonth()+1+'').padStart(2, '0')}-${(date.getDate()+'').padStart(2, '0')}`
})



Vue.prototype.$http = axios

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
